<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PDNSim: src/ir_solver.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">PDNSim
   </div>
   <div id="projectbrief">Power grid analysis</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">ir_solver.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="ir__solver_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment">BSD 3-Clause License</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment">Copyright (c) 2020, The Regents of the University of Minnesota</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment">All rights reserved.</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment">Redistribution and use in source and binary forms, with or without</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment">modification, are permitted provided that the following conditions are met:</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment">* Redistributions of source code must retain the above copyright notice, this</span></div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment">  list of conditions and the following disclaimer.</span></div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment">* Redistributions in binary form must reproduce the above copyright notice,</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment">  this list of conditions and the following disclaimer in the documentation</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment">  and/or other materials provided with the distribution.</span></div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">* Neither the name of the copyright holder nor the names of its</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">  contributors may be used to endorse or promote products derived from</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">  this software without specific prior written permission.</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"></span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span></div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</span></div><div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE</span></div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL</span></div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="comment">DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="comment">SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span></div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;<span class="comment">CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,</span></div><div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;<span class="comment">OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;<span class="comment">OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;<span class="comment">*/</span></div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;<span class="preprocessor">#ifndef __IRSOLVER_IRSOLVER_</span></div><div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;<span class="preprocessor">#define __IRSOLVER_IRSOLVER_</span></div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="gmat_8h.html">gmat.h</a>&quot;</span></div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;<span class="preprocessor">#include &quot;db.h&quot;</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;<span class="comment">/* </span></div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;<span class="comment"> * Builds the equations GV=J and uses SuperLU </span></div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;<span class="comment"> * to solve the matrix equations</span></div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="classIRSolver.html">   43</a></span>&#160;<span class="keyword">class </span><a class="code" href="classIRSolver.html">IRSolver</a></div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;{</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160; <span class="keyword">public</span>:</div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;  <span class="comment">/*</span></div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;<span class="comment">   * This constructor creates an instance of the class using</span></div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;<span class="comment">   * the given inputs.</span></div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;<span class="comment">   */</span></div><div class="line"><a name="l00051"></a><span class="lineno"><a class="line" href="classIRSolver.html#ade5e2e1c97895d8e9c37141f62eccbd9">   51</a></span>&#160;  <a class="code" href="classIRSolver.html#ade5e2e1c97895d8e9c37141f62eccbd9">IRSolver</a>(odb::dbDatabase*         t_db,</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;           std::string              verilog_stor,</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;           std::string              top_module,</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;           std::string              sdc_file,</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;           std::vector&lt;std::string&gt; lib_stor,</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;           std::string              vsrc_loc)</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;  {</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    m_db           = t_db;</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    m_verilog_stor = verilog_stor;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    m_sdc_file     = sdc_file;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    m_lib_stor     = lib_stor;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    m_top_module   = top_module;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    m_vsrc_file    = vsrc_loc;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    ReadC4Data();</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    CreateGmat();</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    CreateJ();</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    AddC4Bump();</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    m_Gmat-&gt;<a class="code" href="classGMat.html#acc6b68783732ff34b6dd4098cb738836">GenerateCSCMatrix</a>();</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;  }</div><div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="classIRSolver.html#a3f8f596fc1314294c91650c9aea1b276">   71</a></span>&#160;  <a class="code" href="classIRSolver.html#a3f8f596fc1314294c91650c9aea1b276">~IRSolver</a>() { <span class="keyword">delete</span> m_Gmat; }</div><div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="classIRSolver.html#aa994255bf8405bc13d0a887797b8bc42">   73</a></span>&#160;  <span class="keywordtype">double</span>                                      <a class="code" href="classIRSolver.html#aa994255bf8405bc13d0a887797b8bc42">wc_voltage</a>;</div><div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="classIRSolver.html#acc781b74c7a8a7af351f55d06d00a922">   75</a></span>&#160;  <span class="keywordtype">double</span>                                      <a class="code" href="classIRSolver.html#acc781b74c7a8a7af351f55d06d00a922">vdd</a>;</div><div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classIRSolver.html#aa0336f80d573aecc0e6269d7f91441cc">   77</a></span>&#160;  <span class="keywordtype">double</span>                                      <a class="code" href="classIRSolver.html#aa0336f80d573aecc0e6269d7f91441cc">avg_voltage</a>;</div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="classIRSolver.html#a06dc6ff621f8d90cea84fe74e1d9ffda">   79</a></span>&#160;  std::vector&lt;double&gt;                         <a class="code" href="classIRSolver.html#a06dc6ff621f8d90cea84fe74e1d9ffda">wc_volt_layer</a>;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;  <a class="code" href="classGMat.html">GMat</a>*                                       <a class="code" href="classIRSolver.html#a72b07b8b929136c0cac95077dce87990">GetGMat</a>();</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;  std::vector&lt;double&gt;                         <a class="code" href="classIRSolver.html#a15a1b2f7bbbd71cd568e532bf03ce1b0">GetJ</a>();</div><div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;  <span class="keywordtype">void</span>                                        <a class="code" href="classIRSolver.html#ad0c6ef5800e5892f441e11b57d19dcaf">SolveIR</a>();</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;  std::vector&lt;std::pair&lt;std::string, double&gt;&gt; <a class="code" href="classIRSolver.html#addd237968206ba6e1c875180eddd562f">GetPower</a>();</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160; </div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160; <span class="keyword">private</span>:</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;  odb::dbDatabase*         m_db;</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;  std::string              m_verilog_stor;</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;  std::vector&lt;std::string&gt; m_lib_stor;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;  std::string              m_sdc_file;</div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;  std::string              m_top_module;</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;  std::string              m_vsrc_file;</div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;  <a class="code" href="classGMat.html">GMat</a>*                    m_Gmat;</div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;  <span class="keywordtype">int</span> m_node_density{2800};  <span class="comment">// TODO get from somewhere</span></div><div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;<span class="comment"></span>  std::vector&lt;double&gt;                            m_J;</div><div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;  std::vector&lt;std::tuple&lt;int, int, int, double&gt;&gt; m_C4Bumps;</div><div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;  std::vector&lt;NodeIdx&gt;                           m_C4GLoc;</div><div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;  <span class="keywordtype">void</span>                                           AddC4Bump();</div><div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;  <span class="keywordtype">void</span>                                           ReadC4Data();</div><div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;  <span class="keywordtype">void</span>                                           CreateJ();</div><div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;  <span class="keywordtype">void</span>                                           CreateGmat();</div><div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;};</div><div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="preprocessor">#endif</span></div><div class="ttc" id="classIRSolver_html_a15a1b2f7bbbd71cd568e532bf03ce1b0"><div class="ttname"><a href="classIRSolver.html#a15a1b2f7bbbd71cd568e532bf03ce1b0">IRSolver::GetJ</a></div><div class="ttdeci">std::vector&lt; double &gt; GetJ()</div><div class="ttdoc">Returns current map represented as a 1D vector. </div><div class="ttdef"><b>Definition:</b> ir_solver.cpp:87</div></div>
<div class="ttc" id="classIRSolver_html_ad0c6ef5800e5892f441e11b57d19dcaf"><div class="ttname"><a href="classIRSolver.html#ad0c6ef5800e5892f441e11b57d19dcaf">IRSolver::SolveIR</a></div><div class="ttdeci">void SolveIR()</div><div class="ttdoc">Function to solve for IR drop. </div><div class="ttdef"><b>Definition:</b> ir_solver.cpp:94</div></div>
<div class="ttc" id="classIRSolver_html_a72b07b8b929136c0cac95077dce87990"><div class="ttname"><a href="classIRSolver.html#a72b07b8b929136c0cac95077dce87990">IRSolver::GetGMat</a></div><div class="ttdeci">GMat * GetGMat()</div><div class="ttdoc">Returns the created G matrix for the design. </div><div class="ttdef"><b>Definition:</b> ir_solver.cpp:77</div></div>
<div class="ttc" id="classIRSolver_html_a3f8f596fc1314294c91650c9aea1b276"><div class="ttname"><a href="classIRSolver.html#a3f8f596fc1314294c91650c9aea1b276">IRSolver::~IRSolver</a></div><div class="ttdeci">~IRSolver()</div><div class="ttdoc">IRSolver destructor. </div><div class="ttdef"><b>Definition:</b> ir_solver.h:71</div></div>
<div class="ttc" id="classGMat_html_acc6b68783732ff34b6dd4098cb738836"><div class="ttname"><a href="classGMat.html#acc6b68783732ff34b6dd4098cb738836">GMat::GenerateCSCMatrix</a></div><div class="ttdeci">void GenerateCSCMatrix()</div><div class="ttdoc">Function which generates the compressed sparse column matrix. </div><div class="ttdef"><b>Definition:</b> gmat.cpp:347</div></div>
<div class="ttc" id="classIRSolver_html"><div class="ttname"><a href="classIRSolver.html">IRSolver</a></div><div class="ttdoc">Class for IR solver. </div><div class="ttdef"><b>Definition:</b> ir_solver.h:43</div></div>
<div class="ttc" id="classIRSolver_html_ade5e2e1c97895d8e9c37141f62eccbd9"><div class="ttname"><a href="classIRSolver.html#ade5e2e1c97895d8e9c37141f62eccbd9">IRSolver::IRSolver</a></div><div class="ttdeci">IRSolver(odb::dbDatabase *t_db, std::string verilog_stor, std::string top_module, std::string sdc_file, std::vector&lt; std::string &gt; lib_stor, std::string vsrc_loc)</div><div class="ttdoc">Constructor for IRSolver class. </div><div class="ttdef"><b>Definition:</b> ir_solver.h:51</div></div>
<div class="ttc" id="classIRSolver_html_a06dc6ff621f8d90cea84fe74e1d9ffda"><div class="ttname"><a href="classIRSolver.html#a06dc6ff621f8d90cea84fe74e1d9ffda">IRSolver::wc_volt_layer</a></div><div class="ttdeci">std::vector&lt; double &gt; wc_volt_layer</div><div class="ttdoc">Vector of worstcase voltages in the lowest layers. </div><div class="ttdef"><b>Definition:</b> ir_solver.h:79</div></div>
<div class="ttc" id="classIRSolver_html_aa0336f80d573aecc0e6269d7f91441cc"><div class="ttname"><a href="classIRSolver.html#aa0336f80d573aecc0e6269d7f91441cc">IRSolver::avg_voltage</a></div><div class="ttdeci">double avg_voltage</div><div class="ttdoc">Average voltage at lowest layer nodes. </div><div class="ttdef"><b>Definition:</b> ir_solver.h:77</div></div>
<div class="ttc" id="classIRSolver_html_addd237968206ba6e1c875180eddd562f"><div class="ttname"><a href="classIRSolver.html#addd237968206ba6e1c875180eddd562f">IRSolver::GetPower</a></div><div class="ttdeci">std::vector&lt; std::pair&lt; std::string, double &gt; &gt; GetPower()</div><div class="ttdoc">Function to get the power value from OpenSTA. </div><div class="ttdef"><b>Definition:</b> ir_solver.cpp:433</div></div>
<div class="ttc" id="classIRSolver_html_acc781b74c7a8a7af351f55d06d00a922"><div class="ttname"><a href="classIRSolver.html#acc781b74c7a8a7af351f55d06d00a922">IRSolver::vdd</a></div><div class="ttdeci">double vdd</div><div class="ttdoc">Voltage supply. </div><div class="ttdef"><b>Definition:</b> ir_solver.h:75</div></div>
<div class="ttc" id="classGMat_html"><div class="ttname"><a href="classGMat.html">GMat</a></div><div class="ttdoc">G matrix class. </div><div class="ttdef"><b>Definition:</b> gmat.h:54</div></div>
<div class="ttc" id="gmat_8h_html"><div class="ttname"><a href="gmat_8h.html">gmat.h</a></div></div>
<div class="ttc" id="classIRSolver_html_aa994255bf8405bc13d0a887797b8bc42"><div class="ttname"><a href="classIRSolver.html#aa994255bf8405bc13d0a887797b8bc42">IRSolver::wc_voltage</a></div><div class="ttdeci">double wc_voltage</div><div class="ttdoc">Worst case voltage at the lowest layer nodes. </div><div class="ttdef"><b>Definition:</b> ir_solver.h:73</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
